package cmd

import (
	"fmt"
	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "cobra",
	Short: "简短的简述",
	Long:  "详细的描述",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("cobra test")
	},
}

func Execute() error {
	return rootCmd.Execute()
}

var userLicense string

func init() {
	// 这里是添加标签
	rootCmd.PersistentFlags().Bool("viper", true, "是否采用viper作为配置文件读取")
	rootCmd.PersistentFlags().StringP("author", "a", "ChenA7", "作者名字")
	rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "授权信息")

	// 添加子命令
	rootCmd.AddCommand(wordCmd)
}
